<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.minshenglife.zanzan.pub.Config" %>
	<%
	String rootPath = Config.getProperty(Config.WX_BASEURL);//应用的根路径
	%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=rootPath%>">
    <title>修改职务</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
  </head>
  <body>
    	<table border="1px" style="width: 100%;" > 
			<tr height="50px">
				<td>员工姓名</td>
				<td>部门名称</td>
				<td>职位</td>
				<td>职级</td>
			</tr>
			<tr>
				<td>${userDeptRole.emp_name}</td>
				<td>${userDeptRole.dept_name}</td>
				<td>${userDeptRole.posiName}</td>
				<td>${userDeptRole.postId}</td>
			</tr>
		</table>
		<form id="minsheng" action="<%=rootPath%>/userRole/updateDept.power">
		<input  type="hidden" name="empId" value="${userDeptRole.empId}"/>
			<p>民生保险</p>
			<hr/>
			<div id="jigou1">
				
			</div>
			<div id="jigou2">
			
			</div>
			<div id="jigou3">
			
			</div>
			<div id="jigou4">
			
			</div>
			<input type="button" value="保存" onclick="submintactin()"/>
		</form>
  </body>
</html>
<script type="text/javascript" src="<%=rootPath%>/jsp/power/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
	/**
	 * 添加分公司
	 */
	$(function(){
		loadindex(null,"1","loadsheng","fengongsi");
	})
	/**
	 * 添加分公司下的子机构
	 * @param {Object} dept_id
	 */
	function loadsheng(dept_id){
		$("#jigou").html("");
		loadindex(dept_id,"2","loadjigou","bumen");
	}
	 /**
	  * 添加机构下的部门
	  * @param {Object} dept_id
	  */
	function loadjigou(dept_id){
		loadindex(dept_id,"3","loadzhiwei","jigou");
	}
	  /**
	   * 添加部门下职位
	   */
	function loadzhiwei(dept_id){
		loadindex(dept_id,"4","loadddelng","zhiwei");
	}
  	function loadddelng(dept_id){
	  
 	}
	function loadindex(dept_id,jspId,index,param){
		$.ajax({
			url:"<%=rootPath%>/userRole/lodedeptSheng.power",
			type: 'GET',
			dataType: "JSON",
			data:'dept_id='+dept_id,
			async: false,
			success: function (obj){
				for(var i=jspId;i<5;i++){
					$("#jigou"+i).html("");
				}
				if(obj.data.length==0){
					$("#jigou"+jspId).html("<h4>机构下没有子机构</h4>");
					return ;
				}
				var str = "";
				for(var i=0;i<obj.data.length;i++){
					str+="<input type=\"radio\" name='"+param+"' value='"+obj.data[i].dept_id+"' onclick=\""+index+"('"+obj.data[i].dept_id+"')\"/>"+obj.data[i].abbr_name;
				}
				$("#jigou"+jspId).html(str+"<hr/>");
			}
		})
	}
	function submintactin(){
		alert("保存成功");
		$("#minsheng").submit();
	}
</script>